# Contributor: FintasticMan <finlay.neon.kid@gmail.com>
# Maintainer: FintasticMan <finlay.neon.kid@gmail.com>
pkgname=metee
pkgver=4.0.0
pkgrel=0
pkgdesc="Cross-platform access library for Intel(R) CSME HECI interface"
url="https://github.com/intel/metee"
arch="x86_64"
license="Apache-2.0"
makedepends="
	cmake
	linux-headers
	samurai
	"
subpackages="$pkgname-dev"
source="https://github.com/intel/metee/archive/$pkgver/metee-$pkgver.tar.gz"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		local crossopts="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=ON \
		-DCMAKE_BUILD_TYPE=None \
		$crossopts
	cmake --build build
}

check() {
	ctest --test-dir build --output-on-failure
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
0c7e6ff111bc3199ae3dda542c6c76fe72e2d9ff6f6145e4906ad28a9ae8ffd6e94cc2e0d1619c30353ddd2fc2bab73adb5182111c3ba20720dd20b3f68587d4  metee-4.0.0.tar.gz
"
